<template>
    <div class="all">
        <div
            v-if="$route.query.row?true:false"
            style="text-align:center;font-size:28px;font-weight:bold;"
        >{{$route.name}}</div>
        <el-page-header v-if="$route.query.row?true:false" @back="goBack" :content="$route.name"></el-page-header>
        <div class="search">
            <el-form
                v-if="$route.query.row?false:true"
                ref="form"
                :model="carWashSearch"
                :inline="true"

                size="mini"
            >
                <el-form-item label="订单号：">
                    <el-input v-model="carWashSearch.number" clearable placeholder="请输入订单号"></el-input>
                </el-form-item>
                <!-- <el-form-item label="商户号：">
                    <el-input v-model="carWashSearch.merchant_num" clearable placeholder="请输入商户号"></el-input>
                </el-form-item>-->
                <el-form-item label="用户名：">
                    <!-- <el-input v-model="carWashSearch.user_id" clearable placeholder="请输入用户名"></el-input> -->
                    <el-select v-model="carWashSearch.user_id" clearable placeholder="请输入用户名">
                        <el-option v-for="item in username" :key="item.id" :label="item.user_name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <!-- <el-form-item label="手机号：">
                    <el-input
                        v-model="carWashSearch.mobilePhone"
                        maxlength="11"
                        clearable
                        placeholder="请输入手机号"
                    ></el-input>
                </el-form-item> -->
                <!-- <el-form-item label="店铺名：">
                    <el-input v-model="carWashSearch.shop_id" clearable placeholder="请输入店铺名"></el-input>
                    <el-select v-model="carWashSearch.shop_id" clearable placeholder="请输入用户名">
                        <el-option v-for="item in shopname" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item> -->
                <!-- <el-form-item label="订单日期：">
                    <el-date-picker
                        v-model="carWashSearch.create_time"
                        type="daterange"
                        format="yyyy-MM-dd"
                        value-format="yyyy-MM-dd"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        :picker-options="pickerOptions"
                    ></el-date-picker>
                </el-form-item> -->
                <el-form-item>
                    <el-button type="primary" @click="searchClick(2)">查 询</el-button>
                </el-form-item>
            </el-form>
        </div>
        <!-- <div class="btn">
            <el-button size="medium" type="primary" @click="remove()">删 除</el-button>
        </div>-->
        <div class="table">
            <!-- 表格 -->
            <el-table
                :data="carWashTable"
                border
                height="560"
                :style="{width:screenWidth+'px'}"
                :cell-style="cellStyle"
                :header-cell-style="rowClass"
                @selection-change="allSelectionChange"
            >
                <!-- <el-table-column type="selection" width="80px"></el-table-column> -->
                <el-table-column label="序号" width="80px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.id }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="订单号" width="230px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.number }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="商户号" width="160px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.merchant_num }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="用户名" width="200px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.user_id | filname }}</span>
                    </template>
                </el-table-column>
                <!-- <el-table-column label="手机号" width="140px">
                    <template slot-scope="scope">
                        
                        <span>{{ scope.row.user_id | userphone }}</span>
                    </template>
                </el-table-column> -->
                <el-table-column label="城市" width="120px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.city }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="车牌" width="120px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.car_id | platenumber }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="车辆类型" width="120px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.car_id | cartype }}</span>
                    </template>
                </el-table-column>
                <!-- <el-table-column label="店名" width="220px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.shop_id }}</span>
                    </template>
                </el-table-column>-->
                <!-- <el-table-column label="消费模式" width="120px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.consumeType }}</span>
                    </template>
                </el-table-column>-->
                <el-table-column label="非会员消费金额" width="120px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.money_nonmember }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="会员消费金额" width="120px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.money_member }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="优惠券" width="120px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.coupon }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="订单创建时间" width="180px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.create_time*1000 | formatDate }} {{ scope.row.create_time*1000 | formatDateBehind }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="订单类型" width="140px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.wash_text }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="订单状态" width="140px">
                    <template slot-scope="scope">
                        <span>{{ orderFromState[scope.row.state] }}</span>
                    </template>
                </el-table-column>
                <!-- <el-table-column v-if="$route.query.row?false:true" label="退款路径" width="120px">
                    <template slot-scope="scope">
                        <span>{{ scope.row.pay_type | filpaytype }}</span>
                        
                    </template>
                </el-table-column> -->
                <!-- <el-button
                            v-if="scope.row.state === 0"
                            size="small"
                            type="warning"
                            @click="refund(scope.$index, scope.row)"
                        >退款</el-button> -->
            </el-table>

            <!-- 分页 -->
            <el-pagination
                @size-change="pageCount"
                @current-change="currentPageCount"
                :current-page="currentPage"
                :page-sizes="[100, 500,1000,1500, 2000]"
                :page-size="currentCount"
                layout="prev, pager, next, jumper, sizes,total"
                :total="pageResultSize"
            ></el-pagination>
        </div>
    </div>
</template>

<script>
import "../../../../static/scss/page.scss";
import utils from "../../../util/request";
import {formatDate } from '../../../util/time.js';
import {timetamp} from "../../../util/time.js"
import {timedata} from "../../../util/time.js"
let that
export default {
    data() {
        return {
            // 分页
            currentPage: 1, //初始页面
            currentCount: 100, //当前页面的数据数量
            pageResultSize: 10, //表格数据总数
            screenWidth: window.innerWidth, //可视宽度
            routerrow: null,
            carWashSearch: {
                //搜索
                number: "", //订单号
                merchant_num: "", //商户号
                user_id: "", //用户名
                // mobilePhone: "", //手机号
                shop_id: "", //店铺名
                // create_time: "" //订单日期
            },
            pickerOptions: {
                disabledDate(time) {
                    return time.getTime() > Date.now();
                }
            },
            carWashTable: [
                // {
                //     number: "46543135431521654862", //订单号orderId
                //     user_id: "愼襡", //用户名nickName
                //     merchant_num:"8456", //商户号
                //     mobilePhone: "17348567495", //手机号mobilePhone
                //     city:"深圳", //城市
                //     carNumber:"粤B12345", //车牌
                //     carType:"SUV", //车型
                //     oneConsumePrice: "10", //消费金额price
                //     twoConsumePrice:"20",
                //     coupon:"2",
                //     consumeTime: "2020-07-15", //订单创建时间orderTime
                //     orderStatus: "已完成" //订单状态orderStatus
                // },
                // {
                //     number: "46946313131132114686", //订单号
                //     user_id: "亦是", //用户名
                //     merchant_num:"8456", //商户号
                //     mobilePhone: "17348567495", //手机号mobilePhone
                //     city:"深圳", //城市
                //     carNumber:"粤B12345", //车牌
                //     carType:"SUV", //车型
                //     oneConsumePrice: "10", //消费金额price
                //     twoConsumePrice:"20",
                //     coupon:"2",
                //     consumeTime: "2020-07-22", //订单创建时间
                //     orderStatus: "进行中" //订单状态
                // },
                // {
                //     number: "48974865631331544715", //订单号
                //     user_id: "待反馈", //用户名
                //     merchant_num:"8456", //商户号
                //     mobilePhone: "17348567495", //手机号mobilePhone
                //     city:"深圳", //城市
                //     carNumber:"粤B12345", //车牌
                //     carType:"SUV", //车型
                //     oneConsumePrice: "10", //消费金额price
                //     twoConsumePrice:"20",
                //     coupon:"2",
                //     consumeTime: "2020-07-30", //订单创建时间
                //     orderStatus: "已退款" //订单状态
                // }
            ],
            username: null,     //用户数据
            carname: null,      //车辆数据
            shopname: null,     //店铺数据
            orderFromState: ["进行中","已完成","已退款"]
        };
    },
    filters: {
        // 支付方式
        filpaytype(id){
            if(id === 1){
                id = "次卡余额"
            }else if(id === 2){
                id = "微信余额"
            }else if(id === 3){
                id = "账户余额"
            }else{return}
            return id
        },
        // 用户名
        filname(id){
            if(that.username !== null){
               that.username.forEach(item=>{
                    id === item.id ? id = item.user_name : '';
                })
                return id 
            }else{return false}
            
        },
        // 手机号
        userphone(id){
            if(that.username !== null){
                that.username.forEach(item=>{
                    id === item.id ? id = item.phone : '';
                })
                return id
            }else{return false}
        },
        // 车牌
        platenumber(id){
            if(that.carname !== null){
                that.carname.forEach(item=>{
                    id === item.id ? id = item.plate_number : '';
                })
                return id
            }else{return false}
        },
        // 车型
        cartype(id){
            if(that.carname !== null){
                let cararr = ["轿车","suv","mpv"]
                that.carname.forEach(item=>{
                    id === item.id ? id = item.type : '';
                })
                return cararr[id] 
            }else{return false}
        },
         // 时间
		formatDate(time){
			var date = new Date(time);
			return formatDate(date, 'yyyy-MM-dd');
		},
		formatDateBehind(time){
			var date = new Date(time);
			return formatDate(date, 'hh:mm:ss')
		}
    },
    methods: {
        goBack: function() {
            // 页头的返回
            this.$router.go(-1);
        },
        searchClick(num) {
            // 查询
            let data = {page:this.currentPage,list_rows:this.currentCount}
            this.routerrow !== null ? data.user_id = this.routerrow.id : "";
            // 时间范围查找
            // if(this.carWashSearch.create_time !== "" && this.carWashSearch.create_time !== null){
            //     console.log(this.carWashSearch.create_time)
            //     data.haveTime = "1";
            //     data.start_time = timetamp(String(this.carWashSearch.create_time[0]));//开始时间
            //     data.end_time = timedata(this.carWashSearch.create_time[1]);//结束时间))
            // }
            for(var i in this.carWashSearch) this.carWashSearch[i] !== "" && i !== "create_time"  ?  data[i] = this.carWashSearch[i] : "";
            // console.log(data)
            utils.request("/orderWash/list","post",JSON.stringify(data)).then(resp=>{
                console.log(resp)
                this.carWashTable = resp.data.data;
                this.pageResultSize = resp.data.total;
                if(num === 2){
                    resp.data.data.length > 0 
                    ? this.$message({
                        message: "查询数据以显示在表单中",
                        type: "success"
                    }) : this.$message("没有符合条件的订单")
                }else{return false}
            })
        },
        // searchClick() {
        //     // 查询
        //     let startTime, endTime;
        //     console.log(this.carWashSearch.create_time);
        //     if (!this.carWashSearch.create_time) {
        //         startTime = "";
        //         endTime = "";
        //     } else {
        //         startTime = this.carWashSearch.create_time[0] + " " + "00:00:00";
        //         endTime = this.carWashSearch.create_time[1] + " " + "23:59:59";
        //     }
        //     console.log(startTime, endTime);
        //     utils
        //         .request("records", "post", {
        //             orderId: this.carWashSearch.number, //订单号
        //             nickName: this.carWashSearch.user_id, //用户名
        //             mobilePhone: this.carWashSearch.mobilePhone, //手机号
        //             shop_id: this.carWashSearch.shop_id, //店铺名
        //             startTime: startTime, //开始日期时间
        //             endTime: endTime, //结束日期时间
        //             deleteFlag: 0, //查询存续
        //             pageStart: this.currentPage, //页面
        //             pageRequestSize: this.currentCount //请求数据数量
        //         })
        //         .then(res => {
        //             console.log(res);
        //             if (res.data.code === 20000) {
        //                 let mode, orderStatus;
        //                 let list = [];
        //                 let data = res.data.dataList;
        //                 data.forEach(item => {
        //                     if (item.mode == 0) {
        //                         mode = "普通洗";
        //                     } else if (item.mode == 1) {
        //                         mode = "精洗";
        //                     }
        //                     if (item.orderStatus == 0) {
        //                         orderStatus = "进行中";
        //                     } else if (item.orderStatus == 1) {
        //                         orderStatus = "已完成";
        //                     } else if (item.orderStatus == 2) {
        //                         orderStatus = "已退款";
        //                     }
        //                     list.push({
        //                         recordId: item.recordId, //洗车记录Id
        //                         number: item.orderId, //订单号orderId
        //                         merchant_num: "", //商户号
        //                         user_id: item.nickName, //用户名nickName
        //                         mobilePhone: item.mobilePhone, //手机号mobilePhone
        //                         city: "", //城市
        //                         carNumber: "", //车牌
        //                         carType: "", //车辆类型
        //                         coupon: "", //优惠券
        //                         shop_id: item.shop_id, //店铺名shop_id
        //                         consumeType: mode, //消费模式mode
        //                         oneConsumePrice: item.price, //非会员消费金额price
        //                         twoConsumePrice: "", //会员消费金额price
        //                         consumeTime: item.createTime, //订单创建时间orderTime
        //                         orderStatus: orderStatus //订单状态orderStatus
        //                     });
        //                 });
        //                 this.carWashTable = list;
        //                 this.pageResultSize =
        //                     res.data.pageResult.pageResultSize; //数据库总结果数
        //             } else if (res.data.code === 20004) {
        //                 that.$message({
        //                     type: "error",
        //                     message: "请重新登录！"
        //                 });
        //                 that.$router.push("/");
        //             } else if (res.data.code === 20006) {
        //                 // this.equipmentTable = [];
        //             }
        //         });
        // },
        remove() {
            // 删除
            if (this.selectTable.length != 0) {
                this.$confirm("此操作将删除选中的数据, 是否继续?", "删除提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                })
                    .then(data => {
                        for (let i = 0; i < this.selectTable.length; i++) {
                            console.log(this.selectTable[i]);
                            utils
                                .request("record", "put", {
                                    recordId: this.selectTable[i].recordId, //店铺id
                                    deleteFlag: 1 //0存续 1删除
                                })
                                .then(res => {
                                    console.log(res);
                                    if (res.data.code == 20000) {
                                        if (i == this.selectTable.length - 1) {
                                            this.$message({
                                                type: "success",
                                                message: "删除成功!",
                                                duration: 2000
                                            });
                                            this.searchClick();
                                        }
                                    }
                                    if (res.data.code == 20004) {
                                        this.$message({
                                            message: "请重新登录！",
                                            type: "error",
                                            duration: 2000
                                        });
                                        this.$router.push({ path: "/" });
                                    }
                                });
                        }
                    })
                    .catch(err => {
                        console.log("123");
                        this.$message({
                            type: "info",
                            message: "已取消删除"
                        });
                    });
            } else {
                this.$message({
                    type: "warning",
                    message: "您还没有选中要删除的数据!",
                    duration: 2000
                });
            }
        },
        refund(index, row) {
            // 退款
            console.log(row);
            this.$prompt("是否确认申请退款？", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                inputPlaceholder: "请输入确认退款"
            }).then(({ value }) => {
                    console.log(value);
                    if (value == "确认退款") {
                        // let orderId = row.number; //商户订单号
                        // let price = row.consumePrice; //订单金额
                        // let refund = price; //退款金额
                        // if (refund <= price) {
                            utils.request("/orderWash/update","post",JSON.stringify({id:row.id,state:2})).then(resp=>{
                                console.log(resp);
                                this.carWashTable[index].state = 2
                            })
                            // console.log("123");
                            // utils
                            //     .request(
                            //         "refund?orderId=" +
                            //             orderId +
                            //             "&totalFee=" +
                            //             price * 100 +
                            //             "&refundFee=" +
                            //             price * 100,
                            //         "post"
                            //     )
                            //     .then(res => {
                            //         console.log(res);
                            //         if (
                            //             res.data.code === 20000 &&
                            //             res.data.data.result_code == "SUCCESS"
                            //         ) {
                            //             utils
                            //                 .request("record", "put", {
                            //                     recordId: row.recordId, //店铺id
                            //                     orderStatus: 2 //0进行中 1已完成 2已退款
                            //                 })
                            //                 .then(res => {
                            //                     console.log(res);
                            //                     if (res.data.code == 20000) {
                            //                         this.$message({
                            //                             showClose: true,
                            //                             type: "success",
                            //                             message: "确认退款成功"
                            //                         });
                            //                         this.searchClick();
                            //                     }
                            //                     if (res.data.code == 20004) {
                            //                         this.$message({
                            //                             message: "请重新登录！",
                            //                             type: "error",
                            //                             duration: 2000
                            //                         });
                            //                         this.$router.push({
                            //                             path: "/"
                            //                         });
                            //                     }
                            //                 });
                            //         } else if (
                            //             res.data.code === 20000 &&
                            //             res.data.data.result_code == "FAIL"
                            //         ) {
                            //             this.$message({
                            //                 showClose: true,
                            //                 type: "error",
                            //                 message: res.data.data.err_code_des
                            //             });
                            //         } else if (res.data.code === 20000) {
                            //             this.$message({
                            //                 showClose: true,
                            //                 type: "error",
                            //                 message: res.data.msg
                            //             });
                            //         } else if (res.data.code === 20001) {
                            //             this.$message({
                            //                 showClose: true,
                            //                 type: "error",
                            //                 message: "退款出现故障"
                            //             });
                            //         }
                            //     });

                        // } else {
                        //     console.log("退款金额大于订单金额不能退款");
                        // }
                    } else {
                        this.$message({
                            showClose: true,
                            type: "error",
                            message: "输入错误"
                        });
                    }
                })
                .catch(() => {
                    this.$message({
                        showClose: true,
                        type: "info",
                        message: "取消输入"
                    });
                });
        },
        //   表格居中
        cellStyle: function({ row, column, rowIndex, columnIndex }) {
            return "text-align:center;";
        },
        rowClass: function({ row, rowIndex }) {
            return "text-align:center;";
        },
        allSelectionChange: function(val) {
            // 获取选中的内容
            console.log(val);
            this.selectTable = val;
        },
        // 每页数据的数量
        pageCount: function(val) {
            this.currentCount = val;
            this.searchClick(1)
            // let startTime, endTime;
            // console.log(this.carWashSearch.create_time);
            // if (!this.carWashSearch.create_time) {
            //     startTime = "";
            //     endTime = "";
            // } else {
            //     startTime = this.carWashSearch.create_time[0] + " " + "00:00:00";
            //     endTime = this.carWashSearch.create_time[1] + " " + "23:59:59";
            // }
            // console.log(startTime, endTime);
            // utils
            //     .request("records", "post", {
            //         orderId: this.carWashSearch.number, //订单号
            //         nickName: this.carWashSearch.user_id, //用户名
            //         mobilePhone: this.carWashSearch.mobilePhone, //手机号
            //         shop_id: this.carWashSearch.shop_id, //店铺名
            //         startTime: startTime, //开始日期时间
            //         endTime: endTime, //结束日期时间
            //         deleteFlag: 0, //查询存续
            //         pageStart: this.currentPage, //页面
            //         pageRequestSize: this.currentCount //请求数据数量
            //     })
            //     .then(res => {
            //         console.log(res);
            //         if (res.data.code === 20000) {
            //             let mode, orderStatus;
            //             let list = [];
            //             let data = res.data.dataList;
            //             data.forEach(item => {
            //                 if (item.mode == 0) {
            //                     mode = "普通洗";
            //                 } else if (item.mode == 1) {
            //                     mode = "精洗";
            //                 }
            //                 if (item.orderStatus == 0) {
            //                     orderStatus = "进行中";
            //                 } else if (item.orderStatus == 1) {
            //                     orderStatus = "已完成";
            //                 } else if (item.orderStatus == 2) {
            //                     orderStatus = "已退款";
            //                 }
            //                 list.push({
            //                     recordId: item.recordId, //洗车记录Id
            //                     number: item.orderId, //订单号orderId
            //                     merchant_num: "", //商户号
            //                     user_id: item.nickName, //用户名nickName
            //                     mobilePhone: item.mobilePhone, //手机号mobilePhone
            //                     city: "", //城市
            //                     carNumber: "", //车牌
            //                     carType: "", //车辆类型
            //                     coupon: "", //优惠券
            //                     shop_id: item.shop_id, //店铺名shop_id
            //                     consumeType: mode, //消费模式mode
            //                     oneConsumePrice: item.price, //非会员消费金额price
            //                     twoConsumePrice: "", //会员消费金额price
            //                     consumeTime: item.createTime, //订单创建时间orderTime
            //                     orderStatus: orderStatus //订单状态orderStatus
            //                 });
            //             });
            //             this.carWashTable = list;
            //             this.pageResultSize =
            //                 res.data.pageResult.pageResultSize; //数据库总结果数
            //         } else if (res.data.code === 20004) {
            //             that.$message({
            //                 type: "error",
            //                 message: "请重新登录！"
            //             });
            //             that.$router.push("/");
            //         } else if (res.data.code === 20006) {
            //             // this.equipmentTable = [];
            //         }
            //     });
        },
        // 点击的第几页
        currentPageCount: function(val) {
            this.currentPage = val;
            this.searchClick(1)
            // let startTime, endTime;
            // console.log(this.carWashSearch.create_time);
            // if (!this.carWashSearch.create_time) {
            //     startTime = "";
            //     endTime = "";
            // } else {
            //     startTime = this.carWashSearch.create_time[0] + " " + "00:00:00";
            //     endTime = this.carWashSearch.create_time[1] + " " + "23:59:59";
            // }
            // console.log(startTime, endTime);
            // utils
            //     .request("records", "post", {
            //         orderId: this.carWashSearch.number, //订单号
            //         nickName: this.carWashSearch.user_id, //用户名
            //         mobilePhone: this.carWashSearch.mobilePhone, //手机号
            //         shop_id: this.carWashSearch.shop_id, //店铺名
            //         startTime: startTime, //开始日期时间
            //         endTime: endTime, //结束日期时间
            //         deleteFlag: 0, //查询存续
            //         pageStart: this.currentPage, //页面
            //         pageRequestSize: this.currentCount //请求数据数量
            //     })
            //     .then(res => {
            //         console.log(res);
            //         if (res.data.code === 20000) {
            //             let mode, orderStatus;
            //             let list = [];
            //             let data = res.data.dataList;
            //             data.forEach(item => {
            //                 if (item.mode == 0) {
            //                     mode = "普通洗";
            //                 } else if (item.mode == 1) {
            //                     mode = "精洗";
            //                 }
            //                 if (item.orderStatus == 0) {
            //                     orderStatus = "进行中";
            //                 } else if (item.orderStatus == 1) {
            //                     orderStatus = "已完成";
            //                 } else if (item.orderStatus == 2) {
            //                     orderStatus = "已退款";
            //                 }
            //                 list.push({
            //                     recordId: item.recordId, //洗车记录Id
            //                     number: item.orderId, //订单号orderId
            //                     merchant_num: "", //商户号
            //                     user_id: item.nickName, //用户名nickName
            //                     mobilePhone: item.mobilePhone, //手机号mobilePhone
            //                     city: "", //城市
            //                     carNumber: "", //车牌
            //                     carType: "", //车辆类型
            //                     coupon: "", //优惠券
            //                     shop_id: item.shop_id, //店铺名shop_id
            //                     consumeType: mode, //消费模式mode
            //                     oneConsumePrice: item.price, //非会员消费金额price
            //                     twoConsumePrice: "", //会员消费金额price
            //                     consumeTime: item.createTime, //订单创建时间orderTime
            //                     orderStatus: orderStatus //订单状态orderStatus
            //                 });
            //             });
            //             this.carWashTable = list;
            //             this.pageResultSize =
            //                 res.data.pageResult.pageResultSize; //数据库总结果数
            //         } else if (res.data.code === 20004) {
            //             that.$message({
            //                 type: "error",
            //                 message: "请重新登录！"
            //             });
            //             that.$router.push("/");
            //         } else if (res.data.code === 20006) {
            //             // this.equipmentTable = [];
            //         }
            //     });
        }
    },
    created() {
        if(this.$route.query.row !== undefined){
            this.routerrow = JSON.parse(this.$route.query.row)
        }
        utils.request("/user/list","post",JSON.stringify({page:1,list_rows:999999999})).then(resp=>{
            // console.log("用户",resp)
            this.username = resp.data.data.data;
        })
        utils.request("/shop/list","post",JSON.stringify({page:1,list_rows:999999999})).then(resp=>{
            // console.log("店铺",resp)
            this.shopname = resp.data.data.data;
        })
        utils.request("/car/list","post",JSON.stringify({page:1,list_rows:999999999})).then(resp=>{
            // console.log("车辆",resp)
            this.carname = resp.data.data.data;
        })
        setTimeout(()=>{
            this.searchClick(1)
        },300)
        let data = {
            car_id: 23,
            city: "合肥市",
            coupon: "1.00",
            create_time: "1603360522",
            id: 1,
            merchant_num: "10",
            money_member: "60.00",
            money_nonmember: "90.00",
            number: "1",
            one_money: 1,
            shop_id: 3,
            state: 1,
            user_id: 59
        }
        // console.log(data)
        // utils.request("/orderWash/add","post",JSON.stringify(data)).then(resp=>{
        //     console.log(resp)
        // })
        // let row = this.$route.query.row;
        // if (row !== "[object Object]") {
        //     console.log(row);
        // }
        // utils
        //     .request("records", "post", {
        //         deleteFlag: 0, //查询存续
        //         pageStart: this.currentPage, //页面
        //         pageRequestSize: this.currentCount //请求数据数量
        //     })
        //     .then(res => {
        //         console.log(res);
        //         if (res.data.code === 20000) {
        //             let mode, orderStatus;
        //             let list = [];
        //             let data = res.data.dataList;
        //             data.forEach(item => {
        //                 if (item.mode == 0) {
        //                     mode = "普通洗";
        //                 } else if (item.mode == 1) {
        //                     mode = "精洗";
        //                 }
        //                 if (item.orderStatus == 0) {
        //                     orderStatus = "进行中";
        //                 } else if (item.orderStatus == 1) {
        //                     orderStatus = "已完成";
        //                 } else if (item.orderStatus == 2) {
        //                     orderStatus = "已退款";
        //                 }
        //                 list.push({
        //                     recordId: item.recordId, //洗车记录Id
        //                     number: item.orderId, //订单号orderId
        //                     merchant_num: "", //商户号
        //                     user_id: item.nickName, //用户名nickName
        //                     mobilePhone: item.mobilePhone, //手机号mobilePhone
        //                     city: "", //城市
        //                     carNumber: "", //车牌
        //                     carType: "", //车辆类型
        //                     coupon: "", //优惠券
        //                     shop_id: item.shop_id, //店铺名shop_id
        //                     consumeType: mode, //消费模式mode
        //                     oneConsumePrice: item.price, //非会员消费金额price
        //                     twoConsumePrice: "", //会员消费金额price
        //                     consumeTime: item.createTime, //订单创建时间orderTime
        //                     orderStatus: orderStatus //订单状态orderStatus
        //                 });
        //             });
        //             this.carWashTable = list;
        //             this.pageResultSize = res.data.pageResult.pageResultSize; //数据库总结果数
        //         } else if (res.data.code === 20004) {
        //             that.$message({
        //                 type: "error",
        //                 message: "请重新登录！"
        //             });
        //             that.$router.push("/");
        //         } else if (res.data.code === 20006) {
        //             // this.equipmentTable = [];
        //         }
        //     });
    },
    computed: {},
    watch: {
        "carWashSearch.mobilePhone"(newValue, oldValue) {
            console.log(newValue, oldValue);
        }
    },
    beforeCreate() {
        that = this;
    },
};
</script>


